<?php defined('SYSPATH') or die('No direct access allowed.');

	class Model_Filterelement extends Model{
		
		public $terms = array();
		public $glue = " AND ";
		
		public function setGlueOperator($glue){
			$this->glue = $glue;
		}
		
		public function add($tablefield,$operator,$operand_value){
			array_push($this->terms,array("tablefield"=>$tablefield,"operator"=>$operator,"operand_value"=>$operand_value));
		}
		
		public function toString(){
			$serialized_terms = array();
			foreach($this->terms as $term){
				$serialized_terms[] = $term["tablefield"]." ".$term["operator"]." ".$term["operand_value"];
			}
			return "(".implode($this->glue,$serialized_terms).")";
		}
	}
	
?>	
